package com.api.organization.adduser;

import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.api.test.VoidContextLoader;
import com.zyncro.api.IOrganizationApiService;
import com.zyncro.api.exceptions.ZyncroApiException;

@ContextConfiguration(loader = VoidContextLoader.class)
public class AddOrgUser extends AbstractApiTest {

	private static final long STORAGE_2MB = 2097152;

	private String userId;
	private String userPassword;

	private String orgName = "statictags";

	@BeforeClass
	public void setUpVariables() {

		this.userId = orgName + "@yopmail.com";
		this.userPassword = "123456";

		getApi().login(userId, userPassword);
	}

	@Test
	public synchronized void testAddUser() throws ZyncroApiException {

		String lastname = "get-user";
		String email = orgName + "-" + lastname + "@yopmail.com";
		String password = "123456";

		long storage = STORAGE_2MB;
		boolean canPublishCorporateFeed = false;
		boolean canCreateGroups = false;
		boolean canCreateDepartments = false;
		boolean isAdministrator = false;

		String langString = "en";
		String attributes = null;

		getApi().getService(IOrganizationApiService.class).addUser(orgName, lastname, email, password, storage, canPublishCorporateFeed,
				canCreateGroups, canCreateDepartments, isAdministrator, langString, attributes);
	}
}
